package action;

import dao.OrderDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(urlPatterns = "/user/action/paymentServlet")
public class paymentServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String orderId = req.getParameter("orderId");
        Integer address = Integer.parseInt(req.getParameter("address"));
        Double payment = Double.parseDouble(req.getParameter("Payment"));
        OrderDao orderDao = new OrderDao();
        orderDao.updateOrderById(orderId,address,payment,"处理中");
        req.setAttribute("orderId",orderId);
        req.setAttribute("payment",payment);
        req.getRequestDispatcher("../page/payment.jsp").forward(req,resp);

    }
}
